package com.xyzboom.web.services;

import com.xyzboom.beans.CourseDeleteResult;
import com.xyzboom.database.dao.CourseDAO;
import com.xyzboom.database.entity.Course;

import java.sql.SQLException;
import java.util.List;
public class CourseService {
    public enum CourseHandleType{
        SUCCESS,
        FAILURE,
        SQLException,
    }
    public static CourseHandleType addNewCourse(Course course) {
        try {
            if (CourseDAO.addNewCourse(course)) {
                return CourseHandleType.SUCCESS;
            }
            return CourseHandleType.FAILURE;
        } catch (SQLException e) {
            e.printStackTrace();
            return CourseHandleType.SQLException;
        }
    }

    public static CourseDeleteResult deleteCourse(List<Integer> ids) {
        return CourseDAO.deleteCourse(ids);
    }
}
